#pragma once

#include "d3d9.h"
#include "d3dx9.h"
#include "HighScore.h"
#include "Text.h"
#include "Sound.h"
#include "DirectInput.h"
#include "SpriteManager.h"
#include <string>

#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")

using namespace std;

class EndGame
{
private:
	///////////////////////////////////////////////
	// POINTERS TO NEEDED CLASSES
	DirectInput*		m_pDirectInput;
	bool				bKeyDown[256];
	SpriteManager*		m_pSpriteManager;
	Sound*				m_pSound;
	Text*				m_pText;
	HighScore*			m_pHighScore;

	// Singleton instance for EndGame
	static EndGame*		m_EndGameInstance;

	// DirectX device
	IDirect3DDevice9*	m_pD3DDevice;
	HWND				hWin;
	
	// Variables for sprites and states
	short	sEndScreen;
	short	sSubmitScoreScreen;
	short	sTotalScore;
	bool	bPass;
	short	sGameState;
	

public:
	EndGame(void);
	~EndGame(void);

	enum eEndState{JUSTENDED, GETTINGNAME};
	short sEndGame;

	// Singleton instance
	static EndGame* GetInstance(void);
	void DeleteEndGameInstance(void);

	void Init(IDirect3DDevice9* m_Device, HWND hWnd, HINSTANCE hInst, DirectInput* directInput, int nWidth, int nHeight);
	void LoadEndGameSprites(void);
	void Update(HWND hWnd, HINSTANCE hInst, float deltaTime);
	void Render(void);
	short GetScore(short userScore);
	short GetStateEndGame(void);

	// Shutdown
	void Shutdown(void);
};
